﻿/*
 * 名称：TNormNpc
 * 创建人：John
 * 创建时间：2012-3-6 9:35:39
 * 描述:
 *********************************************
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using SystemModule;

namespace M2Server
{
    public partial class TNormNpc : TAnimalObject
    {
        /// <summary>
        /// 游戏NPC类型
        /// </summary>
        public TNpcType m_NpcType = TNpcType.n_Merchant;
        /// <summary>
        /// 用于标识此NPC是否有效，用于重新加载NPC列表(-1 为无效)
        /// </summary>
        public sbyte m_nFlag = 0;
        /// <summary>
        /// 脚本列表
        /// </summary>        
        public IList<TSayingRecord> m_ScriptList = null;
        /// <summary>
        /// 跳转脚本ID列表
        /// </summary>
        public int[] FGotoLable;
        /// <summary>
        /// 历史脚本编号
        /// </summary>
        public int FOldLabel;
        /// <summary>
        /// 脚本文件所在目录
        /// </summary>
        public string m_sFilePath = string.Empty;
        /// <summary>
        /// 此NPC是否是隐藏的，不显示在地图中
        /// </summary>
        public bool m_boIsHide = false;
        /// <summary>
        /// NPC类型为地图任务型的，加载脚本时的脚本文件名为 角色名-地图号.txt
        /// </summary>
        public bool m_boIsQuest = false;
        public string m_sPath = string.Empty;
        /// <summary>
        /// 是否变色
        /// </summary>
        public bool m_boNpcAutoChangeColor = false;
        /// <summary>
        /// 变色间隔
        /// </summary>
        public uint m_dwNpcAutoChangeColorTick = 0;
        /// <summary>
        /// 变色时间
        /// </summary>
        public uint m_dwNpcAutoChangeColorTime = 0;
        public int m_nNpcAutoChangeIdx = 0;
        public ushort m_boGotoCount = 0;

        /// <summary>
        /// 初始化
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();
            this.m_Castle = M2Share.g_CastleManager.InCastleWarArea(this);
        }

        public TNormNpc()
            : base()
        {
            this.m_boSuperMan = true;
            this.m_btRaceServer = Grobal2.RC_NPC;
            this.m_nLight = 2;
            this.m_btAntiPoison = 99;
            m_ScriptList = new List<TSayingRecord>();
            this.m_boStickMode = true;
            m_sFilePath = "";
            m_boIsHide = false;
            m_boIsQuest = true;
            m_boNpcAutoChangeColor = false;
            m_dwNpcAutoChangeColorTick = HUtil32.GetTickCount();
            m_dwNpcAutoChangeColorTime = 0;
            m_nNpcAutoChangeIdx = 0;
            m_boGotoCount = 0;// 执行Goto的次数
            FGotoLable = new int[100];
        }

        public virtual void ClearScript()
        {
            TSayingRecord Script = null;
            try
            {
                if (m_ScriptList.Count > 0)
                {
                    for (int i = 0; i < m_ScriptList.Count; i++)
                    {
                        Script = m_ScriptList[i];
                        //if (Script.RecordList.Count > 0)
                        //{
                        //    Script.RecordList.Clear();
                        //}
                        //Dispose(Script.RecordList);
                        Dispose(Script);
                    }
                }
                m_ScriptList.Clear();
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ClearScript");
            }
        }

        /// <summary>
        /// 点击NPC
        /// </summary>
        /// <param name="PlayObject"></param>
        public virtual void Click(TPlayObject PlayObject)
        {
            try
            {
                if (!this.m_boGhost)
                {
                    if (PlayObject != null)
                    {
                        PlayObject.m_nScriptGotoCount = 0;
                        PlayObject.m_sScriptGoBackLable = "";
                        PlayObject.m_sScriptCurrLable = "";
                        GotoLable(PlayObject, "@main", false);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.Click");
            }
        }

        private void ExeAction(TPlayObject PlayObject, string sParam1, string sParam2, string sParam3, int nParam1, int nParam2, int nParam3)
        {
            int nInt1;
            int dwInt;
            try
            {
                // ================================================
                // 更改人物当前经验值
                // EXEACTION CHANGEEXP 0 经验数  设置为指定经验值
                // EXEACTION CHANGEEXP 1 经验数  增加指定经验
                // EXEACTION CHANGEEXP 2 经验数  减少指定经验
                // ================================================
                if ((sParam1).ToLower().CompareTo(("CHANGEEXP").ToLower()) == 0)
                {
                    nInt1 = HUtil32.Str_ToInt(sParam2, -1);
                    switch (nInt1)
                    {
                        case 0:
                            if (nParam3 >= 0)
                            {
                                PlayObject.m_Abil.Exp = nParam3;
                                PlayObject.HasLevelUp(PlayObject.m_Abil.Level - 1);
                            }
                            break;
                        case 1:
                            if (PlayObject.m_Abil.Exp >= nParam3)
                            {
                                if ((PlayObject.m_Abil.Exp - nParam3) > (uint.MaxValue - PlayObject.m_Abil.Exp))
                                {
                                    dwInt = int.MaxValue - PlayObject.m_Abil.Exp;
                                }
                                else
                                {
                                    dwInt = (int)nParam3;
                                }
                            }
                            else
                            {
                                if ((nParam3 - PlayObject.m_Abil.Exp) > (uint.MaxValue - (uint)nParam3))
                                {
                                    dwInt = int.MaxValue - nParam3;
                                }
                                else
                                {
                                    dwInt = nParam3;
                                }
                            }
                            PlayObject.m_Abil.Exp += dwInt;
                            PlayObject.HasLevelUp(PlayObject.m_Abil.Level - 1);
                            break;
                        case 2:
                            if (PlayObject.m_Abil.Exp > nParam3)
                            {
                                PlayObject.m_Abil.Exp -= nParam3;
                            }
                            else
                            {
                                PlayObject.m_Abil.Exp = 0;
                            }
                            PlayObject.HasLevelUp(PlayObject.m_Abil.Level - 1);
                            break;
                    }
                    PlayObject.SysMsg("您当前经验点数为: " + (PlayObject.m_Abil.Exp).ToString() + "/" + (PlayObject.m_Abil.MaxExp).ToString(), TMsgColor.c_Green, TMsgType.t_Hint);
                    return;
                }
                // ================================================
                // 更改人物当前等级
                // EXEACTION CHANGELEVEL 0 等级数  设置为指定等级
                // EXEACTION CHANGELEVEL 1 等级数  增加指定等级
                // EXEACTION CHANGELEVEL 2 等级数  减少指定等级
                // ================================================
                if ((sParam1).ToLower().CompareTo(("CHANGELEVEL").ToLower()) == 0)
                {
                    nInt1 = HUtil32.Str_ToInt(sParam2, -1);
                    switch (nInt1)
                    {
                        case 0:
                            if (nParam3 >= 0)
                            {
                                PlayObject.m_Abil.Level = (ushort)nParam3;
                                PlayObject.HasLevelUp(PlayObject.m_Abil.Level - 1);// 等级调整记录日志
                                M2Share.AddGameDataLog("17" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09"
                                    + (PlayObject.m_nCurrY).ToString() + "\09" + PlayObject.m_sCharName + "\09" + (PlayObject.m_Abil.Level).ToString() + "\09"
                                    + "0" + "\09" + "=(" + ((uint)nParam3).ToString() + ")" + "\09" + this.m_sCharName);
                            }
                            break;
                        case 1:
                            if (PlayObject.m_Abil.Level >= (uint)nParam3)
                            {
                                if ((PlayObject.m_Abil.Level - (uint)nParam3) > (uint.MaxValue - PlayObject.m_Abil.Level))
                                {
                                    dwInt = int.MaxValue - PlayObject.m_Abil.Level;
                                }
                                else
                                {
                                    dwInt = nParam3;
                                }
                            }
                            else
                            {
                                if (((uint)nParam3 - PlayObject.m_Abil.Level) > (uint.MaxValue - (uint)nParam3))
                                {
                                    dwInt = int.MaxValue - nParam3;
                                }
                                else
                                {
                                    dwInt = nParam3;
                                }
                            }
                            PlayObject.m_Abil.Level += (ushort)dwInt;
                            PlayObject.HasLevelUp(PlayObject.m_Abil.Level - 1);// 等级调整记录日志
                            M2Share.AddGameDataLog("17" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09"
                                + (PlayObject.m_nCurrY).ToString() + "\09" + PlayObject.m_sCharName + "\09" + (PlayObject.m_Abil.Level).ToString()
                                + "\09" + "0" + "\09" + "+(" + (dwInt).ToString() + ")" + "\09" + this.m_sCharName);
                            break;
                        case 2:
                            if (PlayObject.m_Abil.Level > (uint)nParam3)
                            {
                                PlayObject.m_Abil.Level -= (ushort)nParam3;
                            }
                            else
                            {
                                PlayObject.m_Abil.Level = 0;
                            }
                            PlayObject.HasLevelUp(PlayObject.m_Abil.Level - 1);// 等级调整记录日志
                            M2Share.AddGameDataLog("17" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09"
                                + (PlayObject.m_nCurrY).ToString() + "\09" + PlayObject.m_sCharName + "\09" + (PlayObject.m_Abil.Level).ToString()
                                + "\09" + "0" + "\09" + "-(" + ((uint)nParam3).ToString() + ")" + "\09" + this.m_sCharName);
                            break;
                    }
                    PlayObject.SysMsg("您当前等级为: " + (PlayObject.m_Abil.Level).ToString(), TMsgColor.c_Green, TMsgType.t_Hint);
                    return;
                }
                // ================================================
                // 杀死人物
                // EXEACTION KILL 0 人物死亡,不显示凶手信息
                // EXEACTION KILL 1 人物死亡不掉物品,不显示凶手信息
                // EXEACTION KILL 2 人物死亡,显示凶手信息为NPC
                // EXEACTION KILL 3 人物死亡不掉物品,显示凶手信息为NPC
                // ================================================
                if ((sParam1).ToLower().CompareTo(("KILL").ToLower()) == 0)
                {
                    nInt1 = HUtil32.Str_ToInt(sParam2, -1);
                    switch (nInt1)
                    {
                        case 1:
                            PlayObject.m_boNoItem = true;
                            PlayObject.Die();
                            break;
                        case 2:
                            PlayObject.SetLastHiter(this);
                            PlayObject.Die();
                            break;
                        case 3:
                            PlayObject.m_boNoItem = true;
                            PlayObject.SetLastHiter(this);
                            PlayObject.Die();
                            break;
                        default:
                            PlayObject.Die();
                            break;
                    }
                    return;
                }
                // ================================================
                // 踢人物下线
                // EXEACTION KICK
                // ================================================
                if ((sParam1).ToLower().CompareTo(("KICK").ToLower()) == 0)
                {
                    PlayObject.m_boKickFlag = true;
                    return;
                }
                // ==============================================================================
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ExeAction");
            }
        }

        public virtual void GetVariableText(TPlayObject PlayObject, ref string sMsg, string sVariable)
        {
            ScriptBase.GetVariableText(this, PlayObject, ref sMsg, sVariable);
        }

        /// <summary>
        /// 取行文本变量信息
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="sMsg"></param>
        /// <returns></returns>
        public string GetLineVariableText(TPlayObject PlayObject, string sMsg)
        {
            string result = string.Empty;
            int nC;
            string s10 = string.Empty;
            try
            {
                nC = 0;
                while (true)
                {
                    if (HUtil32.TagCount(sMsg, '>') < 1)
                    {
                        break;
                    }
                    HUtil32.ArrestStringEx(sMsg, "<", ">", ref s10);
                    GetVariableText(PlayObject, ref sMsg, s10);
                    nC++;
                    if (nC >= 101)
                    {
                        break;
                    }
                }
                result = sMsg;
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.GetLineVariableText");
            }
            return result;
        }

        /// <summary>
        /// 执行脚本处理
        /// </summary>
        /// <returns></returns>
        public bool QuestActionProcess(TPlayObject PlayObject, TUserItem UserItem, IList<TQuestActionInfo> ActionList)
        {
            bool result = true;
            bool bo11 = false;
            int II, III;
            TQuestActionInfo QuestActionInfo;
            int n14 = 0, n18 = 0, n1C = 0, n28 = 0, n2C = 0, n20X = 0, n24Y = 0,
                n34 = 0, n38 = 0, n3C = 0, n40 = 0, n20 = 0, m_DelayGoto = 0;
            string s4C = string.Empty, s50 = string.Empty, s34 = string.Empty, s44 = string.Empty, s48 = string.Empty;
            Envirnoment Envir;
            List<TPlayObject> List58;
            List<TBaseObject> List59;
            TPlayObject User;
            string sName = string.Empty;
            TPlayObject OnlinePlayObject;
            TGuildRank GuildRank;
            TPlayObject UserObject = null;
            int CMDCode = 0;
            try
            {
                if (ActionList == null)
                {
                    return result;
                }
                if (ActionList.Count > 0)
                {
                    for (var i = 0; i < ActionList.Count; i++)
                    {
                        QuestActionInfo = ActionList[i];
                        if (QuestActionInfo != null)
                        {
                            CMDCode = QuestActionInfo.nCMDCode;
                            switch (QuestActionInfo.nCMDCode)
                            {
                                case M2Share.nSET:
                                    n28 = HUtil32.Str_ToInt(QuestActionInfo.sParam1, 0);
                                    n2C = HUtil32.Str_ToInt(QuestActionInfo.sParam2, 0);
                                    PlayObject.SetQuestFlagStatus(n28, n2C);
                                    break;
                                case M2Share.nTAKE:
                                    GotoLable_TakeItem(PlayObject, QuestActionInfo.sParam1, QuestActionInfo.nParam2, QuestActionInfo.sParam2, QuestActionInfo.sParam3);
                                    break;
                                case M2Share.nSC_GIVE:
                                    ActionOfGiveItem(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nTAKEW:
                                    if ((QuestActionInfo.sParam1 != "") && (QuestActionInfo.sParam1[0] == '<') && (QuestActionInfo.sParam1[1] == '$'))
                                    {
                                        s4C = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                                    }
                                    else if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref s4C))
                                    {
                                        s4C = QuestActionInfo.sParam1;
                                    }
                                    if ((QuestActionInfo.sParam2 != "") && (QuestActionInfo.sParam2[0] == '<') && (QuestActionInfo.sParam2[1] == '$'))
                                    {
                                        n14 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), 0);
                                    }
                                    else if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref n14))
                                    {
                                        n14 = QuestActionInfo.nParam2;
                                    }
                                    GotoLable_TakeWItem(PlayObject, s4C, n14);
                                    break;
                                case M2Share.nCLOSE:
                                    PlayObject.SendMsg(this, Grobal2.RM_MERCHANTDLGCLOSE, 0, this.m_ActorsId, 0, 0, "");
                                    break;
                                case M2Share.nRESET:
                                    if (QuestActionInfo.nParam2 <= 0)
                                    {
                                        QuestActionInfo.nParam2 = 1;
                                    }
                                    for (II = 0; II < QuestActionInfo.nParam2; II++)
                                    {
                                        PlayObject.SetQuestFlagStatus(QuestActionInfo.nParam1 + II, 0);
                                    }
                                    break;
                                case M2Share.nBREAK:
                                    if (QuestActionInfo.nParam1 != 0)
                                    {
                                        if ((QuestActionInfo.nParam1 == 1) || (QuestActionInfo.nParam1 == 2))
                                        {
                                            result = false;
                                        }
                                    }
                                    else
                                    {
                                        result = false;
                                    }
                                    break;
                                case M2Share.nTIMERECALL:
                                    PlayObject.m_boTimeRecall = true;
                                    PlayObject.m_sMoveMap = PlayObject.m_sMapName;
                                    PlayObject.m_nMoveX = PlayObject.m_nCurrX;
                                    PlayObject.m_nMoveY = PlayObject.m_nCurrY;
                                    PlayObject.m_dwTimeRecallTick = HUtil32.GetTickCount() + ((uint)QuestActionInfo.nParam1 * 60000);// 60 * 1000
                                    break;
                                case M2Share.nSC_PARAM1:
                                    n34 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), 0);
                                    s44 = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                                    break;
                                case M2Share.nSC_PARAM2:
                                    n38 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), 0);
                                    s48 = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                                    break;
                                case M2Share.nSC_PARAM3:
                                    n3C = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), 0);
                                    s4C = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                                    break;
                                case M2Share.nSC_PARAM4:
                                    n40 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), 0);
                                    s50 = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                                    break;
                                case M2Share.nSC_EXEACTION:
                                    n40 = QuestActionInfo.nParam1;
                                    s50 = QuestActionInfo.sParam1;
                                    ExeAction(PlayObject, QuestActionInfo.sParam1, QuestActionInfo.sParam2, QuestActionInfo.sParam3, QuestActionInfo.nParam1, QuestActionInfo.nParam2, QuestActionInfo.nParam3);
                                    break;
                                case M2Share.nMAPMOVE:
                                    if ((QuestActionInfo.sParam1 != "") && (QuestActionInfo.sParam1[0] == '<') && (QuestActionInfo.sParam1[1] == '$'))
                                    {
                                        s4C = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                                    }
                                    else
                                    {
                                        s4C = QuestActionInfo.sParam1;
                                    }
                                    if ((QuestActionInfo.sParam2 != "") && (QuestActionInfo.sParam2[0] == '<') && (QuestActionInfo.sParam2[1] == '$')) // 增加支持<$Str()>
                                    {
                                        n14 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), 0);
                                    }
                                    else if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref n14))
                                    {
                                        n14 = QuestActionInfo.nParam2;
                                    }
                                    if ((QuestActionInfo.sParam3 != "") && (QuestActionInfo.sParam3[0] == '<') && (QuestActionInfo.sParam3[1] == '$'))
                                    {
                                        n40 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), 0);
                                    }
                                    else if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam3, ref n40))
                                    {
                                        n40 = QuestActionInfo.nParam3;
                                    }
                                    PlayObject.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                                    PlayObject.SpaceMove(s4C, n14, n40, 0);
                                    bo11 = true;
                                    break;
                                case M2Share.nMAP:
                                    if ((QuestActionInfo.sParam1 != "") && (QuestActionInfo.sParam1[0] == '<') && (QuestActionInfo.sParam1[1] == '$'))
                                    {
                                        s4C = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                                    }
                                    else
                                    {
                                        s4C = QuestActionInfo.sParam1;
                                    }
                                    PlayObject.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                                    PlayObject.MapRandomMove(s4C, 0);
                                    bo11 = true;
                                    break;
                                case M2Share.nTAKECHECKITEM:
                                    if (UserItem != null)
                                    {
                                        PlayObject.QuestTakeCheckItem(UserItem);
                                    }
                                    else
                                    {
                                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sTAKECHECKITEM);
                                    }
                                    break;
                                case M2Share.nMONGEN:// 扩展支持变量
                                    s34 = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);// 怪物名
                                    n34 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), 0);// 范围
                                    n40 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), 1);// 数量
                                    for (II = 0; II < n40; II++)
                                    {
                                        n20X = HUtil32.Random(n34 * 2 + 1) + (n38 - n34);
                                        n24Y = HUtil32.Random(n34 * 2 + 1) + (n3C - n34);
                                        M2Share.UserEngine.RegenMonsterByName(s44, n20X, n24Y, s34);// 地图,X,Y,名字
                                    }
                                    break;
                                case M2Share.nMONCLEAR:
                                    List59 = new List<TBaseObject>();
                                    s34 = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                                    M2Share.UserEngine.GetMapMonster(M2Share.g_MapManager.FindMap(s34), List59);
                                    if (List59.Count > 0)
                                    {
                                        for (II = 0; II < List59.Count; II++)
                                        {
                                            List59[II].m_boNoItem = true;
                                            List59[II].m_WAbil.HP = 0;
                                        }
                                    }
                                    Dispose(List59);
                                    break;
                                case M2Share.nMOV:
                                    GotoLable_MovData(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nINC:
                                    GotoLable_IncInteger(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nDEC:
                                    GotoLable_DecInteger(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSUM:
                                    n18 = 0;
                                    if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "<$STR(", 6)) // SUM 支持字符串变量
                                    {
                                        HUtil32.ArrestStringEx(QuestActionInfo.sParam1, "(", ")", ref s34);
                                        n14 = M2Share.GetValNameNo(s34);
                                    }
                                    else
                                    {
                                        n14 = M2Share.GetValNameNo(QuestActionInfo.sParam1);
                                    }
                                    if (!ScriptBase.GetVarValues(PlayObject, n14, ref n18, ref s44))
                                    {
                                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSUM);
                                    }
                                    n1C = 0;
                                    if (HUtil32.CompareLStr(QuestActionInfo.sParam2, "<$STR(", 6))// SUM 支持字符串变量
                                    {
                                        HUtil32.ArrestStringEx(QuestActionInfo.sParam2, "(", ")", ref s34);
                                        n14 = M2Share.GetValNameNo(s34);
                                    }
                                    else
                                    {
                                        n14 = M2Share.GetValNameNo(QuestActionInfo.sParam2);
                                    }
                                    if (!ScriptBase.GetVarValues(PlayObject, n14, ref n18, ref s44))
                                    {
                                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSUM);
                                    }
                                    if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "<$STR(", 6))// SUM 支持字符串变量
                                    {
                                        HUtil32.ArrestStringEx(QuestActionInfo.sParam1, "(", ")", ref s34);
                                        n14 = M2Share.GetValNameNo(s34);
                                    }
                                    else
                                    {
                                        n14 = M2Share.GetValNameNo(QuestActionInfo.sParam1);
                                    }
                                    if (n14 >= 0)
                                    {
                                        ScriptBase.SetVarValues(PlayObject, n14, n18 + n1C, s44 + s48);
                                    }
                                    break;
                                case M2Share.nSC_DIV:// 变量运算 除法  格式: DIV N1 N2 N3 即N1=N2/N3
                                    n18 = 0;
                                    n14 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                                    if (n14 < 0)
                                    {
                                        n14 = M2Share.GetValNameNo(QuestActionInfo.sParam2);
                                        if (!ScriptBase.GetVarValues(PlayObject, n14, ref n18, ref s44))
                                        {
                                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_DIV);
                                        }
                                        if (!string.IsNullOrEmpty(s44)) //不能对字符串进行除法运算
                                        {
                                            ScriptActionError(PlayObject, "无法对字符串进行除法运算", QuestActionInfo, M2Share.sSC_DIV);
                                        }
                                    }
                                    else
                                    {
                                        n18 = n14;
                                    }
                                    n1C = 0;
                                    n14 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), -1);
                                    if (n14 < 0)
                                    {
                                        n14 = M2Share.GetValNameNo(QuestActionInfo.sParam3);
                                        if (!ScriptBase.GetVarValues(PlayObject, n14, ref n18, ref s44))
                                        {
                                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_DIV);
                                        }
                                        if (!string.IsNullOrEmpty(s44)) //不能对字符串进行除法运算
                                        {
                                            ScriptActionError(PlayObject, "无法对字符串进行除法运算", QuestActionInfo, M2Share.sSC_DIV);
                                        }
                                    }
                                    else
                                    {
                                        n1C = n14;
                                    }
                                    if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "<$STR(", 6)) // 支持字符串变量
                                    {
                                        HUtil32.ArrestStringEx(QuestActionInfo.sParam1, "(", ")", ref s34);
                                        n14 = M2Share.GetValNameNo(s34);
                                    }
                                    else
                                    {
                                        n14 = M2Share.GetValNameNo(QuestActionInfo.sParam1);
                                    }
                                    if (n14 >= 0)
                                    {
                                        ScriptBase.SetVarValues(PlayObject, n14, n18 / n1C, null);
                                    }
                                    break;
                                case M2Share.nSC_MUL:// 变量运算 乘法  格式: MUL N1 N2 N3 即N1=N2*N3
                                    n18 = 0;
                                    n14 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                                    if (n14 < 0)
                                    {
                                        n14 = M2Share.GetValNameNo(QuestActionInfo.sParam2);
                                        if (!ScriptBase.GetVarValues(PlayObject, n14, ref n18, ref s44))
                                        {
                                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_MUL);
                                        }
                                        if (!string.IsNullOrEmpty(s44))  //对字符串变量进行处理
                                        {
                                            if (HUtil32.rangeInDefined(n14, 600, 699))
                                            {
                                                n18 = HUtil32.Str_ToInt(PlayObject.m_sString[n14 - 600], 1);
                                            }
                                            else if (HUtil32.rangeInDefined(n14, 700, 799))
                                            {
                                                n18 = HUtil32.Str_ToInt(M2Share.g_Config.GlobalAVal[n14 - 700], 1);
                                            }
                                            else if (HUtil32.rangeInDefined(n14, 800, 1199))
                                            {
                                                n18 = M2Share.g_Config.GlobalVal[n14 - 700];
                                            }
                                            else if (HUtil32.rangeInDefined(n14, 1200, 1599))
                                            {
                                                n18 = HUtil32.Str_ToInt(M2Share.g_Config.GlobalAVal[n14 - 1100], 1);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        n18 = n14;
                                    }
                                    n1C = 0;
                                    n14 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), -1);
                                    if (n14 < 0)
                                    {
                                        n14 = M2Share.GetValNameNo(QuestActionInfo.sParam3);
                                        if (!ScriptBase.GetVarValues(PlayObject, n14, ref n1C, ref s44))
                                        {
                                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_MUL);
                                        }
                                        if (!string.IsNullOrEmpty(s44))  //对字符串变量进行处理
                                        {
                                            if (HUtil32.rangeInDefined(n14, 600, 699))
                                            {
                                                n1C = HUtil32.Str_ToInt(PlayObject.m_sString[n14 - 600], 1);
                                            }
                                            else if (HUtil32.rangeInDefined(n14, 700, 799))
                                            {
                                                n1C = HUtil32.Str_ToInt(M2Share.g_Config.GlobalAVal[n14 - 700], 1);
                                            }
                                            else if (HUtil32.rangeInDefined(n14, 800, 1199))
                                            {
                                                n1C = M2Share.g_Config.GlobalVal[n14 - 700];
                                            }
                                            else if (HUtil32.rangeInDefined(n14, 1200, 1599))
                                            {
                                                n1C = HUtil32.Str_ToInt(M2Share.g_Config.GlobalAVal[n14 - 1100], 1);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        n1C = n14;
                                    }
                                    if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "<$STR(", 6))   //  支持字符串变量
                                    {
                                        HUtil32.ArrestStringEx(QuestActionInfo.sParam1, "(", ")", ref s34);
                                        n14 = M2Share.GetValNameNo(s34);
                                    }
                                    else
                                    {
                                        n14 = M2Share.GetValNameNo(QuestActionInfo.sParam1);
                                    }
                                    // 取第一个变量,并传值给n18
                                    if (n14 >= 0)
                                    {
                                        ScriptBase.SetVarValues(PlayObject, n14, n18 * n1C, Convert.ToString(n18 * n1C));
                                    }
                                    break;
                                case M2Share.nSC_PERCENT:// 变量运算 百分比  格式: PERCENT N1 N2 N3 即N1=(N2/N3)*100
                                    n18 = 0;
                                    n14 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                                    if (n14 < 0)
                                    {
                                        n14 = M2Share.GetValNameNo(QuestActionInfo.sParam2);// 取第一个变量,并传值给n18
                                        if (n14 >= 0)
                                        {
                                            switch (n14)
                                            {
                                                // Modify the A .. B: 0 .. 99
                                                case 0:
                                                    // 20080323 原为0..99
                                                    n18 = PlayObject.m_nVal[n14];
                                                    break;
                                                // Modify the A .. B: 100 .. 199
                                                case 100:
                                                    n18 = M2Share.g_Config.GlobalVal[n14 - 100];
                                                    break;
                                                // Modify the A .. B: 200 .. 299
                                                case 200:
                                                    // 20080323 原为200..209
                                                    n18 = PlayObject.m_DyVal[n14 - 200];
                                                    break;
                                                // Modify the A .. B: 300 .. 399
                                                case 300:
                                                    n18 = PlayObject.m_nMval[n14 - 300];
                                                    break;
                                                // Modify the A .. B: 400 .. 499
                                                case 400:
                                                    n18 = M2Share.g_Config.GlobaDyMval[n14 - 400];
                                                    break;
                                                // Modify the A .. B: 500 .. 599
                                                case 500:
                                                    n18 = PlayObject.m_nInteger[n14 - 500];
                                                    break;
                                                // Modify the A .. B: 800 .. 1199
                                                case 800:
                                                    // 20080903 G变量
                                                    n18 = M2Share.g_Config.GlobalVal[n14 - 700];
                                                    break;
                                                default:
                                                    // 1800..2799:begin//20080323 i变量
                                                    // n18 := g_Config.GlobaDyMval[n14 - 1800];
                                                    // end;
                                                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_PERCENT);
                                                    break;
                                            }
                                            // case
                                        }
                                        else
                                        {
                                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_PERCENT);
                                        }
                                    }
                                    else
                                    {
                                        n18 = n14;
                                    }
                                    n1C = 0;
                                    n14 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), -1);
                                    if (n14 < 0)
                                    {
                                        n14 = M2Share.GetValNameNo(QuestActionInfo.sParam3);// 取第一个变量,并传值给n1C
                                        if (n14 >= 0)
                                        {
                                            switch (n14)
                                            {
                                                // Modify the A .. B: 0 .. 99
                                                case 0:// 原为0..99
                                                    n1C = PlayObject.m_nVal[n14];
                                                    break;
                                                // Modify the A .. B: 100 .. 199
                                                case 100:
                                                    n1C = M2Share.g_Config.GlobalVal[n14 - 100];
                                                    break;
                                                // Modify the A .. B: 200 .. 299
                                                case 200://  原为200..209
                                                    n1C = PlayObject.m_DyVal[n14 - 200];
                                                    break;
                                                // Modify the A .. B: 300 .. 399
                                                case 300:
                                                    n1C = PlayObject.m_nMval[n14 - 300];
                                                    break;
                                                // Modify the A .. B: 400 .. 499
                                                case 400:
                                                    n1C = M2Share.g_Config.GlobaDyMval[n14 - 400];
                                                    break;
                                                // Modify the A .. B: 500 .. 599
                                                case 500:
                                                    n1C = PlayObject.m_nInteger[n14 - 500];
                                                    break;
                                                // Modify the A .. B: 800 .. 1199
                                                case 800:// G变量
                                                    n1C = M2Share.g_Config.GlobalVal[n14 - 700];
                                                    break;
                                                default:
                                                    // 1800..2799:begin//20080323 i变量
                                                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_PERCENT);
                                                    break;
                                            }
                                        }
                                        else
                                        {
                                            // ScriptActionError(PlayObject,'',QuestActionInfo,sSC_PERCENT);
                                        }
                                    }
                                    else
                                    {
                                        n1C = n14;
                                    }
                                    if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "<$STR(", 6))
                                    {
                                        // 支持字符串变量
                                        HUtil32.ArrestStringEx(QuestActionInfo.sParam1, "(", ")", ref s34);
                                        n14 = M2Share.GetValNameNo(s34);
                                    }
                                    else
                                    {
                                        n14 = M2Share.GetValNameNo(QuestActionInfo.sParam1);
                                    }
                                    if (n14 >= 0)
                                    {
                                        switch (n14)
                                        {
                                            // Modify the A .. B: 0 .. 99
                                            case 0:
                                                // 20080323 原为0..99
                                                PlayObject.m_nVal[n14] = n18 / n1C * 100;
                                                break;
                                            // Modify the A .. B: 100 .. 199
                                            case 100:
                                                M2Share.g_Config.GlobalVal[n14 - 100] = n18 / n1C * 100;
                                                break;
                                            // Modify the A .. B: 200 .. 299
                                            case 200:
                                                // 20080323 原为200..209
                                                PlayObject.m_DyVal[n14 - 200] = n18 / n1C * 100;
                                                break;
                                            // Modify the A .. B: 300 .. 399
                                            case 300:
                                                PlayObject.m_nMval[n14 - 300] = n18 / n1C * 100;
                                                break;
                                            // Modify the A .. B: 400 .. 499
                                            case 400:
                                                M2Share.g_Config.GlobaDyMval[n14 - 400] = n18 / n1C * 100;
                                                break;
                                            // Modify the A .. B: 500 .. 599
                                            case 500:
                                                PlayObject.m_nInteger[n14 - 500] = n18 / n1C * 100;
                                                break;
                                            // Modify the A .. B: 600 .. 699
                                            case 600:
                                                PlayObject.m_sString[n14 - 600] = (n18 / n1C * 100).ToString() + "%";
                                                break;
                                            // 20080606
                                            // Modify the A .. B: 700 .. 799
                                            case 700:
                                                M2Share.g_Config.GlobalAVal[n14 - 700] = (n18 / n1C * 100).ToString() + "%";
                                                break;
                                            // 20080606
                                            // Modify the A .. B: 800 .. 1199
                                            case 800:
                                                // 20080903 G变量
                                                M2Share.g_Config.GlobalVal[n14 - 700] = n18 / n1C * 100;
                                                break;
                                            // Modify the A .. B: 1200 .. 1599
                                            case 1200:
                                                // 20080903 A变量(100-499)
                                                M2Share.g_Config.GlobalAVal[n14 - 1100] = (n18 / n1C * 100).ToString() + "%";
                                                break;
                                        }
                                    }
                                    break;
                                case M2Share.nBREAKTIMERECALL:
                                    PlayObject.m_boTimeRecall = false;
                                    break;
                                case M2Share.nPKPOINT:
                                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref n14))
                                    {
                                        n14 = QuestActionInfo.nParam1;
                                    }
                                    if (n14 == 0)
                                    {
                                        PlayObject.m_nPkPoint = 0;
                                    }
                                    else
                                    {
                                        if (n14 < 0)
                                        {
                                            if ((PlayObject.m_nPkPoint + n14) >= 0)
                                            {
                                                PlayObject.m_nPkPoint += n14;
                                            }
                                            else
                                            {
                                                PlayObject.m_nPkPoint = 0;
                                            }
                                        }
                                        else
                                        {
                                            if ((PlayObject.m_nPkPoint + n14) > 10000)
                                            {
                                                PlayObject.m_nPkPoint = 10000;
                                            }
                                            else
                                            {
                                                PlayObject.m_nPkPoint += n14;
                                            }
                                        }
                                    }
                                    PlayObject.RefNameColor();
                                    break;
                                case M2Share.nSC_RECALLMOB:
                                    ActionOfRecallmob(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_RECALLMOBEX:// 召唤宝宝
                                    ActionOfRecallMobex(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_MOVEMOBTO:// 将指定坐标的怪物移动到新坐标
                                    ActionOfMoveMobto(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CLEARITEMMAP:// 清除地图物品
                                    ActionOfClearItemMap(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nKICK:
                                    PlayObject.m_boReconnection = true;
                                    PlayObject.m_boSoftClose = true;
                                    PlayObject.m_boPlayOffLine = false;
                                    PlayObject.m_boNotOnlineAddExp = false;
                                    break;
                                case M2Share.nMOVR:// 取随机值赋给变量   拓展可以随机参数2到参数3之间的数
                                    if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "<$STR(", 6))// 支持字符串变量
                                    {
                                        HUtil32.ArrestStringEx(QuestActionInfo.sParam1, "(", ")", ref s34);
                                        n14 = M2Share.GetValNameNo(s34);
                                    }
                                    else
                                    {
                                        n14 = M2Share.GetValNameNo(QuestActionInfo.sParam1);
                                    }
                                    if (n14 >= 0)
                                    {
                                        if (HUtil32.rangeInDefined(n14, 0, 99))
                                        {
                                            if (QuestActionInfo.nParam3 > QuestActionInfo.nParam2)
                                            {
                                                PlayObject.m_nVal[n14] = QuestActionInfo.nParam2 + HUtil32.Random(QuestActionInfo.nParam3 - QuestActionInfo.nParam2);
                                            }
                                            else
                                            {
                                                PlayObject.m_nVal[n14] = HUtil32.Random(QuestActionInfo.nParam2);
                                            }
                                        }
                                        else if (HUtil32.rangeInDefined(n14, 100, 199))
                                        {
                                            if (QuestActionInfo.nParam3 > QuestActionInfo.nParam2)
                                            {
                                                M2Share.g_Config.GlobalVal[n14 - 100] = QuestActionInfo.nParam2 + HUtil32.Random(QuestActionInfo.nParam3 - QuestActionInfo.nParam2);
                                            }
                                            else
                                            {
                                                M2Share.g_Config.GlobalVal[n14 - 100] = HUtil32.Random(QuestActionInfo.nParam2);
                                            }
                                        }
                                        else if (HUtil32.rangeInDefined(n14, 200, 299))
                                        {
                                            if (QuestActionInfo.nParam3 > QuestActionInfo.nParam2)
                                            {
                                                PlayObject.m_DyVal[n14 - 200] = QuestActionInfo.nParam2 + HUtil32.Random(QuestActionInfo.nParam3 - QuestActionInfo.nParam2);
                                            }
                                            else
                                            {
                                                PlayObject.m_DyVal[n14 - 200] = HUtil32.Random(QuestActionInfo.nParam2);
                                            }
                                        }
                                        else if (HUtil32.rangeInDefined(n14, 300, 399))
                                        {
                                            if (QuestActionInfo.nParam3 > QuestActionInfo.nParam2)
                                            {
                                                PlayObject.m_nMval[n14 - 300] = QuestActionInfo.nParam2 + HUtil32.Random(QuestActionInfo.nParam3 - QuestActionInfo.nParam2);
                                            }
                                            else
                                            {
                                                PlayObject.m_nMval[n14 - 300] = HUtil32.Random(QuestActionInfo.nParam2);
                                            }
                                        }
                                        else if (HUtil32.rangeInDefined(n14, 400, 499))
                                        {
                                            if (QuestActionInfo.nParam3 > QuestActionInfo.nParam2)
                                            {
                                                M2Share.g_Config.GlobaDyMval[n14 - 400] = QuestActionInfo.nParam2 + HUtil32.Random(QuestActionInfo.nParam3 - QuestActionInfo.nParam2);
                                            }
                                            else
                                            {
                                                M2Share.g_Config.GlobaDyMval[n14 - 400] = HUtil32.Random(QuestActionInfo.nParam2);
                                            }
                                        }
                                        else if (HUtil32.rangeInDefined(n14, 500, 599))
                                        {
                                            if (QuestActionInfo.nParam3 > QuestActionInfo.nParam2)
                                            {
                                                PlayObject.m_nInteger[n14 - 500] = QuestActionInfo.nParam2 + HUtil32.Random(QuestActionInfo.nParam3 - QuestActionInfo.nParam2);
                                            }
                                            else
                                            {
                                                PlayObject.m_nInteger[n14 - 500] = HUtil32.Random(QuestActionInfo.nParam2);
                                            }
                                        }
                                        else if (HUtil32.rangeInDefined(n14, 800, 1199))//G变量
                                        {
                                            if (QuestActionInfo.nParam3 > QuestActionInfo.nParam2)
                                            {
                                                M2Share.g_Config.GlobalVal[n14 - 700] = QuestActionInfo.nParam2 + HUtil32.Random(QuestActionInfo.nParam3 - QuestActionInfo.nParam2);
                                            }
                                            else
                                            {
                                                M2Share.g_Config.GlobalVal[n14 - 700] = HUtil32.Random(QuestActionInfo.nParam2);
                                            }
                                        }
                                        else
                                        {
                                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOVR);
                                        }
                                    }
                                    else
                                    {
                                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sMOVR);
                                    }
                                    break;
                                case M2Share.nEXCHANGEMAP:// 两角色互换地图
                                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref s4C))
                                    {
                                        s4C = QuestActionInfo.sParam1;// 地图名称
                                    }
                                    if ((s4C).ToLower().CompareTo(("APPR").ToLower()) == 0) // 师徒地图互换
                                    {
                                        User = M2Share.UserEngine.GetPlayObject(PlayObject.m_sMasterName);
                                        if (User != null)
                                        {
                                            s4C = User.m_sMapName;
                                            User.MapRandomMove(PlayObject.m_sMapName, 0);
                                            PlayObject.MapRandomMove(s4C, 0);
                                        }
                                    }
                                    else if ((s4C).ToLower().CompareTo(("DEAR").ToLower()) == 0) // 夫妻地图互换
                                    {
                                        if (PlayObject.m_DearHuman != null)
                                        {
                                            s4C = PlayObject.m_DearHuman.m_sMapName;
                                            PlayObject.m_DearHuman.MapRandomMove(PlayObject.m_sMapName, 0);
                                            PlayObject.MapRandomMove(s4C, 0);
                                        }
                                    }
                                    else
                                    {
                                        Envir = M2Share.g_MapManager.FindMap(s4C);
                                        if (Envir != null)
                                        {
                                            List58 = new List<TPlayObject>();
                                            M2Share.UserEngine.GetMapRageHuman(Envir, 0, 0, 1000, List58);
                                            if (List58.Count > 0)
                                            {
                                                User = List58[0];
                                                User.MapRandomMove(this.m_sMapName, 0);
                                            }
                                            Dispose(List58);
                                            PlayObject.MapRandomMove(s4C, 0);
                                        }
                                        else
                                        {
                                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sEXCHANGEMAP);
                                        }
                                    }
                                    break;
                                case M2Share.nRECALLMAP:
                                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref s4C))
                                    {
                                        s4C = QuestActionInfo.sParam1;
                                    }
                                    Envir = M2Share.g_MapManager.FindMap(s4C);
                                    if (Envir != null)
                                    {
                                        List58 = new List<TPlayObject>();
                                        M2Share.UserEngine.GetMapRageHuman(Envir, 0, 0, 1000, List58);
                                        if (List58.Count > 0)
                                        {
                                            for (II = 0; II < List58.Count; II++)
                                            {
                                                User = List58[II];
                                                User.MapRandomMove(this.m_sMapName, 0);
                                                if (II > 20)
                                                {
                                                    break;
                                                }
                                            }
                                        }
                                        Dispose(List58);
                                    }
                                    else
                                    {
                                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sRECALLMAP);
                                    }
                                    break;
                                case M2Share.nADDBATCH:
                                    //List1C.Add(QuestActionInfo.sParam1, ((n18) as Object));
                                    break;
                                case M2Share.nBATCHDELAY:
                                    n18 = QuestActionInfo.nParam1 * 1000;
                                    break;
                                case M2Share.nBATCHMOVE:
                                    //if (List1C.Count > 0)
                                    //{
                                    //    for (II = 0; II < List1C.Count; II ++ )
                                    //    {
                                    //        PlayObject.SendDelayMsg(this, Grobal2.RM_10155, 0, 0, 0, 0, List1C[II], ((int)List1C.Values[II]) + n20);
                                    //        n20 += ((int)List1C.Values[II]);
                                    //    }
                                    //}
                                    break;
                                case M2Share.nPLAYDICE:
                                    PlayObject.m_sPlayDiceLabel = QuestActionInfo.sParam2;
                                    PlayObject.SendMsg(this, Grobal2.RM_PLAYDICE, QuestActionInfo.nParam1, HUtil32.MakeLong(HUtil32.MakeWord((byte)PlayObject.m_DyVal[0],
                                        (byte)PlayObject.m_DyVal[1]), HUtil32.MakeWord((byte)PlayObject.m_DyVal[2], (byte)PlayObject.m_DyVal[3])),
                                        HUtil32.MakeLong(HUtil32.MakeWord((byte)PlayObject.m_DyVal[4], (byte)PlayObject.m_DyVal[5]), HUtil32.MakeWord((byte)PlayObject.m_DyVal[6], (byte)PlayObject.m_DyVal[7])),
                                        HUtil32.MakeLong(HUtil32.MakeWord((byte)PlayObject.m_DyVal[8], (byte)PlayObject.m_DyVal[9]), 0), QuestActionInfo.sParam2);
                                    bo11 = true;
                                    break;
                                case M2Share.nSetOnTimer:// 个人定时器(开启)
                                    if (PlayObject != null)
                                    {
                                        n28 = HUtil32.Str_ToInt(QuestActionInfo.sParam1, 0);
                                        n2C = HUtil32.Str_ToInt(QuestActionInfo.sParam2, 0);
                                        n28 = n28 % 10;
                                        if ((n28 > 9) || (n28 < 0))
                                        {
                                            n28 = 0;
                                        }
                                        PlayObject.AutoTimerStatus[n28] = n2C * 1000;
                                        PlayObject.AutoTimerTick[n28] = HUtil32.GetTickCount();
                                    }
                                    break;
                                case M2Share.nSETOFFTIMER:// 停止定时器
                                    if (PlayObject != null)
                                    {
                                        n28 = HUtil32.Str_ToInt(QuestActionInfo.sParam1, 0);
                                        n28 = n28 % 10;
                                        if ((n28 > 9) || (n28 < 0))
                                        {
                                            n28 = 0;
                                        }
                                        PlayObject.AutoTimerStatus[n28] = 0;
                                    }
                                    break;
                                case M2Share.nADDNAMELIST:
                                    GotoLable_AddList(PlayObject.m_sCharName, m_sPath + QuestActionInfo.sParam1);
                                    break;
                                case M2Share.nDELNAMELIST:
                                    GotoLable_DelList(PlayObject.m_sCharName, m_sPath + QuestActionInfo.sParam1);
                                    break;
                                case M2Share.nADDGUILDLIST:
                                    if (PlayObject.m_MyGuild != null)
                                    {
                                        GotoLable_AddList(PlayObject.m_MyGuild.sGuildName, m_sPath + QuestActionInfo.sParam1);
                                    }
                                    break;
                                case M2Share.nDELGUILDLIST:
                                    if (PlayObject.m_MyGuild != null)
                                    {
                                        GotoLable_DelList(PlayObject.m_MyGuild.sGuildName, m_sPath + QuestActionInfo.sParam1);
                                    }
                                    break;
                                case M2Share.nSENDMSG:// 发送文字信息
                                    ActionOfLineMsg(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nCREATEFILE:// 创建文本文件
                                    ActionOfCreateFile(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSENDTOPMSG://特殊公告
                                    ActionOfSendTopMsg(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSENDCENTERMSG:// 顶端滚动公告
                                    ActionOfSendCenterMsg(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSENDEDITTOPMSG:// 屏幕居中显示公告 聊天框顶端公告
                                    ActionOfSendEditTopMsg(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nOPENMAKEWINE:// 打开酿酒窗口
                                    ActionOfOPENMAKEWINE(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nGETGOODMAKEWINE://  取回酿好的酒 
                                    ActionOfGETGOODMAKEWINE(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nDECMAKEWINETIME://减少酿酒的时间 
                                    ActionOfDECMAKEWINETIME(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nREADSKILLNG:// 学习内功 
                                    ActionOfREADSKILLNG(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nMAKEWINENPCMOVE:// 酿酒NPC的走动 
                                    ActionOfMAKEWINENPCMOVE(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nFOUNTAIN:// 设置泉水喷发 
                                    ActionOfFOUNTAIN(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSETGUILDFOUNTAIN:// 开启/关闭行会泉水仓库 
                                    ActionOfSETGUILDFOUNTAIN(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nGIVEGUILDFOUNTAIN:// 领取行会酒水
                                    ActionOfGIVEGUILDFOUNTAIN(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nCHALLENGMAPMOVE:// 挑战地图移动
                                    // ------------------------------------------------------------------------------
                                    ActionOfCHALLENGMAPMOVE(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nGETCHALLENGEBAKITEM://没有挑战地图可移动,则退回抵押的物品 
                                    ActionOfGETCHALLENGEBAKITEM(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nHEROLOGOUT:// 人物在线英雄下线 
                                    // ------------------------------------------------------------------------------
                                    ActionOfHEROLOGOUT(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nGETSORTNAME://  取指定排行榜指定排名的玩家名字
                                    ActionOfGETSORTNAME(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nWEBBROWSER://连接指定网站网址
                                    ActionOfWEBBROWSER(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nKICKALLPLAY:// 踢除服务器所有人物
                                    ActionOfKICKALLPLAY(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nREPAIRALL:// 修理全身装备
                                    ActionOfRepairAll(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nCHANGESKILL:// 功能:修改魔法ID 20080624
                                    ActionOfCHANGESKILL(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nAUTOGOTOXY:// 自动寻路 20080617
                                    ActionOfAUTOGOTOXY(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nADDATTACKSABUKALL:// 设置所有行会攻城
                                    ActionOfADDATTACKSABUKALL(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nOPENBOOKS:// 卧龙
                                    ActionOfOPENBOOKS(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nOPENYBDEAL:// 开通元宝交易
                                    ActionOfOPENYBDEAL(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nQUERYYBSELL:// 查询正在出售的物品
                                    ActionOfQUERYYBSELL(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nQUERYYBDEAL:// 查询可以的购买物品
                                    ActionOfQueryYbDeal(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nTHROUGHHUM:// 改变穿人模式
                                    ActionOfTHROUGHHUM(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSETITEMSLIGHT:// 装备发光设置
                                    ActionOfSetItemsLight(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nOPENDRAGONBOX:// 打开卧龙宝藏
                                    ActionOfOpenDragonBox(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nQUERYREFINEITEM:// 打开淬炼窗口
                                    ActionOfQUERYREFINEITEM(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nGOHOME://  移动到回城点
                                    ActionOfGOHOME(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nTHROWITEM://将指定物品刷新到指定地图坐标范围内 
                                    ActionOfTHROWITEM(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nCLEARCODELIST:// 删除指定文本里的编码
                                    ActionOfCLEARCODELIST(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nGETRANDOMNAME:// 从文件中随机取文本
                                    ActionOfGetRandomName(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nHCall://  通过脚本命令让别人执行QManage.txt中的脚本
                                    ActionOfHCall(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nINCASTLEWARAY:// 检测人物是否在攻城期间的范围内，在则BB叛变
                                    ActionOfINCASTLEWARAY(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nGIVESTATEITEM:// 给予带绑定状态装备
                                    ActionOfGIVESTATEITEM(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSETITEMSTATE:// 设置装备绑定状态
                                    ActionOfSETITEMSTATE(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nADDACCOUNTLIST:
                                    GotoLable_AddList(PlayObject.m_sUserID, m_sPath + QuestActionInfo.sParam1);
                                    break;
                                case M2Share.nDELACCOUNTLIST:
                                    GotoLable_DelList(PlayObject.m_sUserID, m_sPath + QuestActionInfo.sParam1);
                                    break;
                                case M2Share.nADDIPLIST:
                                    GotoLable_AddList(PlayObject.m_sIPaddr, m_sPath + QuestActionInfo.sParam1);
                                    break;
                                case M2Share.nDELIPLIST:
                                    GotoLable_DelList(PlayObject.m_sIPaddr, m_sPath + QuestActionInfo.sParam1);
                                    break;
                                case M2Share.nGOQUEST:
                                    GotoLable_GoToQuest(PlayObject, QuestActionInfo.nParam1);
                                    break;
                                case M2Share.nENDQUEST:
                                    PlayObject.m_Script = null;
                                    break;
                                case M2Share.nGOTO:
                                    if (!GotoLable_JmpToLable(PlayObject, QuestActionInfo.sParam1))
                                    {
                                        M2Share.MainOutMessage("[脚本死循环] NPC:" + this.m_sCharName + " 位置:" + this.m_sMapName
                                            + "(" + (this.m_nCurrX).ToString() + ":" + (this.m_nCurrY).ToString() + ")" + " 命令:"
                                            + M2Share.sGOTO + " " + QuestActionInfo.sParam1);
                                        result = false;
                                        return result;
                                    }
                                    break;
                                case M2Share.nSC_HAIRSTYLE:
                                    ActionOfChangeHairStyle(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CLEARNAMELIST:
                                    ActionOfClearNameList(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGELEVEL:
                                    ActionOfChangeLevel(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_MARRY:
                                    ActionOfMarry(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_MASTER:
                                    ActionOfMaster(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_UNMASTER:
                                    ActionOfUnMaster(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_UNMARRY:
                                    ActionOfUnMarry(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GETMARRY:
                                    ActionOfGetMarry(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GETMASTER:
                                    ActionOfGetMaster(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CLEARSKILL:
                                    ActionOfClearSkill(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_DELNOJOBSKILL:
                                    ActionOfDelNoJobSkill(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_DELSKILL:
                                    ActionOfDelSkill(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_ADDSKILL:
                                    ActionOfAddSkill(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_ADDGUILDMEMBER: // 添加行会成员
                                    ActionOfADDGUILDMEMBER(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_DELGUILDMEMBER:// 删除行会成员（删除掌门无效
                                    ActionOfDelGuildMember(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_SKILLLEVEL:// 调整人物技能等级
                                    ActionOfSkillLevel(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_HEROSKILLLEVEL:// 调整英雄技能等级 20080415
                                    ActionOfHeroSkillLevel(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEPKPOINT:
                                    ActionOfChangePkPoint(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEEXP:
                                    ActionOfChangeExp(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGENGEXP:// 调整内功经验
                                    ActionOfChangeNGExp(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGENGLEVEL: // 调整内功等级
                                    ActionOfCHANGENGLEVEL(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_OPENEXPCRYSTAL:// 客户端显示天地结晶
                                    ActionOfOPENEXPCRYSTAL(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CLOSEEXPCRYSTAL:// 客户端关闭天地结晶
                                    ActionOfCLOSEEXPCRYSTAL(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GETEXPTOCRYSTAL:// 取提天地结晶中的经验(只提取可提取的经验)
                                    ActionOfGETEXPTOCRYSTAL(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_SENDTIMEMSG: // 时间到解发脚本段(客户端显示时间)
                                    ActionOfSENDTIMEMSG(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_SENDMSGWINDOWS:// 时间到解发脚本段
                                    ActionOfSENDMSGWINDOWS(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CLOSEMSGWINDOWS:// 关闭客户端'!'图标的显示
                                    ActionOfCLOSEMSGWINDOWS(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GETGROUPCOUNT:
                                    ActionOfGETGROUPCOUNT(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEJOB:// 取组队成员数
                                    ActionOfChangeJob(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_MISSION:
                                    ActionOfMission(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_MOBPLACE:
                                    ActionOfMobPlace(PlayObject, QuestActionInfo, n34, n38, n3C, n40);
                                    break;
                                case M2Share.nSC_SETMEMBERTYPE:
                                    ActionOfSetMemberType(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_SETMEMBERLEVEL:
                                    ActionOfSetMemberLevel(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GAMEGOLD:
                                    ActionOfGameGold(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GAMEDIAMOND: // 金刚石
                                    ActionOfGameDiaMond(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GAMEGIRD:// 灵符 
                                    ActionOfGameGird(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEHUMABILITY:// 调整人物属性 
                                    ActionOfCHANGEHUMABILITY(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEHEROLOYAL:// 调整英雄的忠诚度 
                                    ActionOfHeroLoyal(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEHEROTRANPOINT:// 调整英雄技能升级点数
                                    ActionOfCHANGEHEROTRANPOINT(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_SAVEHERO: // 寄放英雄
                                    // ----------------------酒馆系统-----------------------------------------------
                                    ActionOfSAVEHERO(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GETHERO:// 取回英雄
                                    ActionOfGETHERO(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CLOSEDRINK: // 关闭斗酒窗口
                                    ActionOfCLOSEDRINK(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_PLAYDRINKMSG: // 斗酒窗口说话信息
                                    ActionOfPLAYDRINKMSG(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_OPENPLAYDRINK:// 指定人物喝酒
                                    ActionOfOPENPLAYDRINK(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GAMEPOINT:
                                    // -----------------------------------------------------------------------------
                                    ActionOfGamePoint(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_AUTOADDGAMEGOLD:
                                    ActionOfAutoAddGameGold(PlayObject, QuestActionInfo, n34, n38);
                                    break;
                                case M2Share.nSC_AUTOSUBGAMEGOLD:
                                    ActionOfAutoSubGameGold(PlayObject, QuestActionInfo, n34, n38);
                                    break;
                                case M2Share.nSC_CHANGENAMECOLOR:
                                    ActionOfChangeNameColor(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CLEARPASSWORD:
                                    ActionOfClearPassword(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_RENEWLEVEL:
                                    ActionOfReNewLevel(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_KILLSLAVE:
                                    ActionOfKillSlave(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEGENDER:
                                    ActionOfChangeGender(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_KILLMONEXPRATE:
                                    ActionOfKillMonExpRate(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_POWERRATE:// 设置攻击力倍数
                                    ActionOfPowerRate(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEMODE:// 改变管理模式
                                    ActionOfChangeMode(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEPERMISSION:
                                    ActionOfChangePerMission(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_KILL:
                                    ActionOfKill(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_KICK:
                                    ActionOfKick(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_BONUSPOINT:
                                    ActionOfBonusPoint(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_RESTRENEWLEVEL:
                                    ActionOfRestReNewLevel(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_DELMARRY:
                                    ActionOfDelMarry(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_DELMASTER:
                                    ActionOfDelMaster(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CREDITPOINT:
                                    ActionOfChangeCreditPoint(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEGUILDMEMBERCOUNT:// 调整行会成员上限
                                    ActionOfCHANGEGUILDMEMBERCOUNT(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEGUILDFOUNTAIN:// 调整行会酒泉
                                    ActionOfCHANGEGUILDFOUNTAIN(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_TAGMAPINFO:// 记路标石
                                    ActionOfTAGMAPINFO(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_TAGMAPMOVE: // 移动到记路标石记录的地图XY
                                    ActionOfTAGMAPMOVE(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GAMEGLORY:// 调整荣誉值
                                    ActionOfChangeCreditGlory(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CLEARNEEDITEMS:
                                    ActionOfClearNeedItems(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CLEARMAEKITEMS:
                                    ActionOfClearMakeItems(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_SETSENDMSGFLAG:
                                    PlayObject.m_boSendMsgFlag = true;
                                    break;
                                case M2Share.nSC_UPGRADEITEMS:
                                    ActionOfUpgradeItems(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_UPGRADEITEMSEX:
                                    ActionOfUpgradeItemsEx(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GIVEMINE:  //给矿石
                                    ActionOfGIVEMINE(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_MONGENEX:
                                    ActionOfMonGenEx(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CLEARMAPMON:
                                    ActionOfClearMapMon(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_SETMAPMODE:
                                    ActionOfSetMapMode(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_PKZONE:
                                    ActionOfPkZone(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_RESTBONUSPOINT:
                                    ActionOfRestBonusPoint(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_TAKECASTLEGOLD:
                                    ActionOfTakeCastleGold(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_HUMANHP:
                                    ActionOfHumanHP(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_HUMANMP:
                                    ActionOfHumanMP(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_BUILDPOINT:
                                    ActionOfGuildBuildPoint(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_AURAEPOINT:
                                    ActionOfGuildAuraePoint(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_STABILITYPOINT:
                                    ActionOfGuildstabilityPoint(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_FLOURISHPOINT:
                                    ActionOfGuildFlourishPoint(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_OPENMAGICBOX:
                                    ActionOfOpenMagicBox(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_SETRANKLEVELNAME:
                                    ActionOfSetRankLevelName(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GMEXECUTE:
                                    ActionOfGmExecute(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GUILDCHIEFITEMCOUNT:
                                    ActionOfGuildChiefItemCount(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_ADDUSERDATE:
                                    ActionOfAddNameDateList(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_DELUSERDATE:
                                    ActionOfDelNameDateList(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_MOBFIREBURN:
                                    ActionOfMobFireBurn(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_MESSAGEBOX:
                                    ActionOfMessageBox(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_SETSCRIPTFLAG:
                                    ActionOfSetScriptFlag(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_SETAUTOGETEXP:
                                    ActionOfAutoGetExp(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_VAR:
                                    ActionOfVar(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_LOADVAR:
                                    ActionOfLoadVar(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_SAVEVAR:
                                    ActionOfSaveVar(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CALCVAR:
                                    ActionOfCalcVar(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nOFFLINEPLAY:
                                    ActionOfNotLineAddPiont(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nKICKOFFLINE:
                                    ActionOfKickNotLineAddPiont(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSTARTTAKEGOLD:
                                    ActionOfStartTakeGold(PlayObject);
                                    break;
                                case M2Share.nDELAYGOTO:// 延时跳转
                                    PlayObject.m_boTimeGoto = true;
                                    m_DelayGoto = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), 0);
                                    if (m_DelayGoto == 0)
                                    {
                                        ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref n20);
                                        m_DelayGoto = n20;
                                    }
                                    if (m_DelayGoto > 0)
                                    {
                                        PlayObject.m_dwTimeGotoTick = HUtil32.GetTickCount() + (uint)m_DelayGoto;
                                    }
                                    else
                                    {
                                        PlayObject.m_dwTimeGotoTick = HUtil32.GetTickCount() + (uint)QuestActionInfo.nParam1;
                                    }
                                    PlayObject.m_sTimeGotoLable = QuestActionInfo.sParam2;// 改成毫秒
                                    PlayObject.m_TimeGotoNPC = (TMerchant)this;
                                    break;
                                case M2Share.nCLEARDELAYGOTO:
                                    PlayObject.m_boTimeGoto = false;
                                    PlayObject.m_sTimeGotoLable = "";
                                    PlayObject.m_TimeGotoNPC = null;
                                    break;
                                case M2Share.nSC_ANSIREPLACETEXT:
                                    ActionOfAnsiReplaceText(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_ENCODETEXT:
                                    ActionOfEncodeText(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_ADDTEXTLIST:
                                    s50 = GetLineVariableText(PlayObject, QuestActionInfo.sParam2);// 文件路径支持变量
                                    if (s50[0] == '\\')
                                    {
                                        s50 = s50.Substring(2 - 1, s50.Length - 1);
                                    }
                                    if (s50[1] == '\\')
                                    {
                                        s50 = s50.Substring(3 - 1, s50.Length - 2);
                                    }
                                    if (s50[1] == '\\')
                                    {
                                        s50 = s50.Substring(4 - 1, s50.Length - 3);
                                    }
                                    s4C = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                                    if (s4C == "")
                                    {
                                        if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref s4C))
                                        {
                                            s4C = QuestActionInfo.sParam1;
                                        }
                                    }
                                    GotoLable_AddList(s4C, s50);
                                    break;
                                case M2Share.nSC_DELTEXTLIST:
                                    s50 = GetLineVariableText(PlayObject, QuestActionInfo.sParam2);// 文件路径支持变量
                                    if (s50[0] == '\\')
                                    {
                                        s50 = s50.Substring(2 - 1, s50.Length - 1);
                                    }
                                    //增加,处理文件路径
                                    if (s50[1] == '\\')
                                    {
                                        s50 = s50.Substring(3 - 1, s50.Length - 2);
                                    }
                                    if (s50[2] == '\\')
                                    {
                                        s50 = s50.Substring(4 - 1, s50.Length - 3);
                                    }
                                    s4C = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);// 变量
                                    if (s4C == "")
                                    {
                                        if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref s4C))
                                        {
                                            s4C = QuestActionInfo.sParam1;
                                        }
                                    }
                                    GotoLable_DelList(s4C, s50);
                                    break;
                                case M2Share.nSC_GROUPMOVE:
                                    s4C = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                                    if (s4C == "")
                                    {
                                        if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref s4C))
                                        {
                                            // 增加变量支持
                                            s4C = QuestActionInfo.sParam1;
                                        }
                                    }
                                    if ((PlayObject.m_GroupOwner != null) && (PlayObject == PlayObject.m_GroupOwner))
                                    {
                                        if (PlayObject.m_GroupOwner.m_GroupMembers.Count > 0)
                                        {
                                            for (II = 0; II < PlayObject.m_GroupOwner.m_GroupMembers.Count; II++)
                                            {
                                                //if ((!((TPlayObject)(PlayObject.m_GroupOwner.m_GroupMembers[II])).m_boDeath) && (!((TPlayObject)(PlayObject.m_GroupOwner.m_GroupMembers[II])).m_boGhost))
                                                //{
                                                //    ((TPlayObject)(PlayObject.m_GroupOwner.m_GroupMembers[II])).MapRandomMove(s4C, 0);
                                                //}
                                            }
                                        }
                                        PlayObject.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                                        bo11 = true;
                                    }
                                    break;
                                case M2Share.nSC_GROUPMAPMOVE:// 组编传送,只有队长才能使用  增加触发段，所有成员可触发QF指定触发段
                                    if ((QuestActionInfo.sParam1 != "") && (QuestActionInfo.sParam1[0] == '<') && (QuestActionInfo.sParam1[1] == '$'))
                                    {
                                        s4C = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                                    }
                                    else if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref s4C)) // 地图号
                                    {
                                        s4C = QuestActionInfo.sParam1;
                                    }
                                    if ((QuestActionInfo.sParam2 != "") && (QuestActionInfo.sParam2[0] == '<') && (QuestActionInfo.sParam2[1] == '$'))
                                    {
                                        n14 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), 0);
                                    }
                                    else if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref n14))
                                    {
                                        n14 = QuestActionInfo.nParam2;
                                    }
                                    if ((QuestActionInfo.sParam3 != "") && (QuestActionInfo.sParam3[0] == '<') && (QuestActionInfo.sParam3[1] == '$'))
                                    {
                                        n40 = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), 0);
                                    }
                                    else if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam3, ref n40))
                                    {
                                        n40 = QuestActionInfo.nParam3;
                                    }
                                    if ((PlayObject.m_GroupOwner != null) && (PlayObject == PlayObject.m_GroupOwner))
                                    {
                                        if (PlayObject.m_GroupOwner.m_GroupMembers.Count > 0)
                                        {
                                            for (II = 0; II < PlayObject.m_GroupOwner.m_GroupMembers.Count; II++)
                                            {
                                                //if ((!((TPlayObject)(PlayObject.m_GroupOwner.m_GroupMembers[II])).m_boDeath) && (!((TPlayObject)(PlayObject.m_GroupOwner.m_GroupMembers[II])).m_boGhost))
                                                //{
                                                //    ((TPlayObject)(PlayObject.m_GroupOwner.m_GroupMembers[II])).SpaceMove(s4C, n14, n40, 0);
                                                //    if ((QuestActionInfo.sParam4 != ""))
                                                //    {
                                                //        // 是否设置触发段
                                                //        if ((M2Share.g_FunctionNPC != null))
                                                //        {
                                                //            M2Share.g_FunctionNPC.GotoLable(((TPlayObject)(PlayObject.m_GroupOwner.m_GroupMembers[II])), QuestActionInfo.sParam4, false);
                                                //        }
                                                //    }
                                                //}
                                            }
                                        }
                                        PlayObject.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                                        bo11 = true;
                                    }
                                    break;
                                case M2Share.nSC_RECALLHUMAN:
                                    s4C = QuestActionInfo.sParam1;
                                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref s4C);
                                    if (s4C != "")
                                    {
                                        PlayObject.RecallHuman(s4C);
                                    }
                                    break;
                                case M2Share.nSC_REGOTO:
                                    s4C = QuestActionInfo.sParam1;
                                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref s4C);
                                    if (s4C != "")
                                    {
                                        OnlinePlayObject = M2Share.UserEngine.GetPlayObject(s4C);
                                        if (PlayObject != null)
                                        {
                                            PlayObject.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                                            PlayObject.SpaceMove(OnlinePlayObject.m_PEnvir.sMapName, OnlinePlayObject.m_nCurrX, OnlinePlayObject.m_nCurrY, 0);
                                            bo11 = true;
                                        }
                                    }
                                    break;
                                case M2Share.nSC_INTTOSTR:
                                    n40 = 0;
                                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref n40);
                                    n14 = M2Share.GetValNameNo(QuestActionInfo.sParam1);
                                    if (n14 >= 0)
                                    {
                                        switch (n14)
                                        {
                                            // Modify the A .. B: 600 .. 699
                                            case 600:
                                                PlayObject.m_sString[n14 - 600] = (n40).ToString();
                                                break;
                                            // Modify the A .. B: 700 .. 799
                                            case 700:
                                                M2Share.g_Config.GlobalAVal[n14 - 700] = (n40).ToString();
                                                break;
                                            // Modify the A .. B: 1200 .. 1599
                                            case 1200:// A变量(100-499)
                                                M2Share.g_Config.GlobalAVal[n14 - 1100] = (n40).ToString();
                                                break;
                                            default:
                                                ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_INTTOSTR);
                                                break;
                                        }
                                    }
                                    break;
                                case M2Share.nSC_STRTOINT:
                                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref s4C);
                                    n14 = M2Share.GetValNameNo(QuestActionInfo.sParam1);
                                    if (n14 >= 0)
                                    {
                                        switch (n14)
                                        {
                                            // Modify the A .. B: 0 .. 99
                                            case 0:
                                                // 20080323 原为0..99
                                                PlayObject.m_nVal[n14] = HUtil32.Str_ToInt(s4C, 0);
                                                break;
                                            // Modify the A .. B: 100 .. 199
                                            case 100:
                                                M2Share.g_Config.GlobalVal[n14 - 100] = HUtil32.Str_ToInt(s4C, 0);
                                                break;
                                            // Modify the A .. B: 200 .. 299
                                            case 200:
                                                // 20080323 原为200..209
                                                PlayObject.m_DyVal[n14 - 200] = HUtil32.Str_ToInt(s4C, 0);
                                                break;
                                            // Modify the A .. B: 300 .. 399
                                            case 300:
                                                PlayObject.m_nMval[n14 - 300] = HUtil32.Str_ToInt(s4C, 0);
                                                break;
                                            // Modify the A .. B: 400 .. 499
                                            case 400:
                                                M2Share.g_Config.GlobaDyMval[n14 - 400] = HUtil32.Str_ToInt(s4C, 0);
                                                break;
                                            // Modify the A .. B: 500 .. 599
                                            case 500:
                                                PlayObject.m_nInteger[n14 - 500] = HUtil32.Str_ToInt(s4C, 0);
                                                break;
                                            // Modify the A .. B: 800 .. 1199
                                            case 800:// G变量
                                                M2Share.g_Config.GlobalVal[n14 - 700] = HUtil32.Str_ToInt(s4C, 0);
                                                break;
                                            default:
                                                // 1800..2799:begin//20080323 i变量
                                                // g_Config.GlobaDyMval[n14 - 1800]:= Str_ToInt(s4C, 0);
                                                // end;
                                                ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_STRTOINT);
                                                break;
                                        }
                                    }
                                    break;
                                case M2Share.nSC_GUILDMOVE:
                                    if (PlayObject.m_MyGuild == null)
                                    {
                                        return result;
                                    }
                                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref s4C))
                                    {
                                        s4C = QuestActionInfo.sParam1;
                                    }
                                    PlayObject.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                                    PlayObject.MapRandomMove(s4C, 0);
                                    if (PlayObject.m_MyGuild.m_RankList.Count > 0)
                                    {
                                        for (II = 0; II < PlayObject.m_MyGuild.m_RankList.Count; II++)
                                        {
                                            GuildRank = PlayObject.m_MyGuild.m_RankList[II];
                                            if (GuildRank == null)
                                            {
                                                continue;
                                            }
                                            if (GuildRank.MemberList.Count > 0)
                                            {
                                                for (III = 0; III < GuildRank.MemberList.Count; III++)
                                                {
                                                    //UserObject = ((TPlayObject)(GuildRank.MemberList[III]));
                                                    if (UserObject == null)
                                                    {
                                                        continue;
                                                    }
                                                    if ((!UserObject.m_boDeath) && (!UserObject.m_boGhost) && (UserObject.m_boAllowGuildReCall))
                                                    {
                                                        UserObject.MapRandomMove(s4C, 0);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    bo11 = true;
                                    break;
                                case M2Share.nSC_GUILDMAPMOVE:
                                    if (PlayObject.m_MyGuild == null)
                                    {
                                        return result;
                                    }
                                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref s4C))
                                    {
                                        s4C = QuestActionInfo.sParam1;
                                    }
                                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref n14))
                                    {
                                        n14 = QuestActionInfo.nParam2;
                                    }
                                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam3, ref n40))
                                    {
                                        n40 = QuestActionInfo.nParam3;
                                    }
                                    PlayObject.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                                    PlayObject.SpaceMove(s4C, n14, n40, 0);
                                    if (PlayObject.m_MyGuild.m_RankList.Count > 0)
                                    {
                                        for (II = 0; II < PlayObject.m_MyGuild.m_RankList.Count; II++)
                                        {
                                            GuildRank = PlayObject.m_MyGuild.m_RankList[II];
                                            if (GuildRank == null)
                                            {
                                                continue;
                                            }
                                            if (GuildRank.MemberList.Count > 0)
                                            {
                                                for (III = 0; III < GuildRank.MemberList.Count; III++)
                                                {
                                                    //UserObject = ((TPlayObject)(GuildRank.MemberList[III]));
                                                    if (UserObject == null)
                                                    {
                                                        continue;
                                                    }
                                                    if ((!UserObject.m_boDeath) && (!UserObject.m_boGhost) && (UserObject.m_boAllowGuildReCall))
                                                    {
                                                        UserObject.SpaceMove(s4C, n14, n40, 0);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    bo11 = true;
                                    break;
                                case M2Share.nSC_RANDOMMOVE:
                                    PlayObject.RandomMove();
                                    bo11 = true;
                                    break;
                                case M2Share.nSC_USEBONUSPOINT:
                                    ActionOfUseBonusPoint(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_REPAIRITEM:
                                    ActionOfRepairItem(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_TAKEONITEM:
                                    ActionOfTakeOnItem(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_TAKEOFFITEM:// 穿上装备
                                    ActionOfTakeOffItem(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CREATEHERO:// 脱下装备
                                    // =================================英雄相关=====================================
                                    ActionOfCreateHero(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_DELETEHERO:
                                    ActionOfDeleteHero(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEHEROLEVEL:
                                    ActionOfChangeHeroLevel(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEHEROJOB:
                                    ActionOfChangeHeroJob(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CLEARHEROSKILL:
                                    ActionOfClearHeroSkill(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEHEROPKPOINT:// 清除英雄技能
                                    ActionOfChangeHeroPKPoint(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEHEROEXP:
                                    ActionOfChangeHeroExp(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_OPENMAKEKIMNEEDLE:
                                    ActionOfOpenMakeKIMNeedle(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_TAKEKIMNEEDLE:
                                    ActionOfTAKEKIMNEEDLE(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_GIVEKIMNEEDLE:
                                    ActionOfGIVEKIMNEEDLE(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_OPENPULSE:
                                    ActionOfOPENPULSE(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEPULSELEVEL:
                                    ActionOfChangePulseLevel(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_OPENHEROPULS:
                                    ActionOfOPENHEROPULS(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGEHEROPULSEXP:
                                    ActionOfCHANGEHEROPULSEXP(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_OPENCATTLEGAS:// 富贵兽命令
                                    ActionOfOPENCATTLEGAS(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CLOSECATTLEGAS:
                                    ActionOfCLOSECATTLEGAS(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGECATTLEGASEXP:
                                    ActionOfCHANGECATTLEGASEXP(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_TAKEITMECOUNTDURA:// 给定持久物品命令  这些给定持久命令没有实现
                                    ActionOfTAKEITMECOUNTDURA(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_ASSESSMENTHERO:
                                    // ---------双英雄命令-------------------//
                                    ActionOfASSESSMENTHERO(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_OpenHeroAutoPractice:
                                    ActionOfOpenHeroAutoPractice(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_StopHeroAutoPractice:
                                    ActionOfStopHeroAutoPractice(PlayObject, QuestActionInfo);
                                    break;
                                case M2Share.nSC_CHANGETRANPOINT:
                                    // ----------------------------------------//
                                    ActionOfCHANGETRANPOINT(PlayObject, QuestActionInfo);
                                    break;
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] QuestActionProcess CMDCode:" + (CMDCode).ToString());
            }
            return result;
        }

        /// <summary>
        /// 发送NPC对话框内容
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="sMsg"></param>
        /// <param name="boFlag"></param>
        public void SendMerChantSayMsg(TPlayObject PlayObject, string sMsg, bool boFlag)
        {
            string s10 = string.Empty;
            string s14 = s14 = sMsg;
            int nC = 0;
            while (true)
            {
                if (HUtil32.TagCount(s14, '>') < 1)
                {
                    break;
                }
                s14 = HUtil32.ArrestStringEx(s14, "<", ">", ref s10);
                GetVariableText(PlayObject, ref sMsg, s10);
                nC++;
                if (nC >= 101)
                {
                    break;
                }
            }
            PlayObject.GetScriptLabel(sMsg);
            if (boFlag)
            {
                PlayObject.SendFirstMsg(this, Grobal2.RM_MERCHANTSAY, 0, 0, 0, 0, this.m_sCharName + "/" + sMsg);
            }
            else
            {
                PlayObject.SendMsg(this, Grobal2.RM_MERCHANTSAY, 0, 0, 0, 0, this.m_sCharName + "/" + sMsg);
            }
        }

        /// <summary>
        /// 读取NPC脚本
        /// </summary>
        public void LoadNpcScript()
        {
            if (m_boIsQuest)
            {
                var s08 = this.m_sCharName + "-" + this.m_sMapName;
                M2Share.ScriptSystem.LoadNpcScript(this, m_sFilePath, s08);
            }
            else
            {
                M2Share.ScriptSystem.LoadNpcScript(this, m_sFilePath, this.m_sCharName);
            }
        }

        public override bool Operate(TProcessMessage ProcessMsg)
        {
            return base.Operate(ProcessMsg);
        }

        public override void Run()
        {
            int nInteger;
            byte nCode = 0;
            try
            {
                nCode = 0;
                if (this.m_Master != null) // 不允许召唤为宝宝
                {
                    this.m_Master = null;
                }
                nCode = 1;// NPC变色
                if (m_boNpcAutoChangeColor && (m_dwNpcAutoChangeColorTime > 0) && (HUtil32.GetTickCount() - m_dwNpcAutoChangeColorTick > m_dwNpcAutoChangeColorTime))
                {
                    nCode = 2;
                    m_dwNpcAutoChangeColorTick = HUtil32.GetTickCount();
                    switch (m_nNpcAutoChangeIdx)
                    {
                        case 0:
                            nInteger = Grobal2.STATE_TRANSPARENT;
                            break;
                        case 1:// 8
                            nInteger = Grobal2.POISON_STONE;
                            break;
                        case 2:// 5
                            nInteger = Grobal2.POISON_DONTMOVE;
                            break;
                        case 3:// 4
                            nInteger = Grobal2.POISON_68;
                            break;
                        case 4:// 68
                            nInteger = Grobal2.POISON_DECHEALTH;
                            break;
                        case 5:// 0
                            nInteger = Grobal2.POISON_LOCKSPELL;
                            break;
                        case 6:// 2
                            nInteger = Grobal2.POISON_DAMAGEARMOR;
                            break;
                        default:// 1
                            m_nNpcAutoChangeIdx = 0;
                            nInteger = Grobal2.STATE_TRANSPARENT;
                            break;
                    }
                    nCode = 3;
                    m_nNpcAutoChangeIdx++;
                    this.m_nCharStatus = Convert.ToInt32((this.m_nCharStatusEx & 0xFFFFF) | ((0x80000000 >> nInteger) | 0));
                    nCode = 4;
                    this.StatusChanged("");
                }
                nCode = 5;
                if (this.m_boFixColor && (this.m_nFixStatus != this.m_nCharStatus))
                {
                    nCode = 6;
                    switch (this.m_nFixColorIdx)
                    {
                        case 0:
                            nInteger = Grobal2.STATE_TRANSPARENT;
                            break;
                        case 1:
                            nInteger = Grobal2.POISON_STONE;
                            break;
                        case 2:
                            nInteger = Grobal2.POISON_DONTMOVE;
                            break;
                        case 3:
                            nInteger = Grobal2.POISON_68;
                            break;
                        case 4:
                            nInteger = Grobal2.POISON_DECHEALTH;
                            break;
                        case 5:
                            nInteger = Grobal2.POISON_LOCKSPELL;
                            break;
                        case 6:
                            nInteger = Grobal2.POISON_DAMAGEARMOR;
                            break;
                        default:
                            this.m_nFixColorIdx = 0;
                            nInteger = Grobal2.STATE_TRANSPARENT;
                            break;
                    }
                    nCode = 7;
                    this.m_nCharStatus = Convert.ToInt32((this.m_nCharStatusEx & 0xFFFFF) | ((0x80000000 >> nInteger) | 0));
                    this.m_nFixStatus = this.m_nCharStatus;
                    nCode = 8;
                    this.StatusChanged("");
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.Run Code:" + nCode);
            }
            base.Run();
        }

        /// <summary>
        /// 脚本错误提示
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="sErrMsg"></param>
        /// <param name="QuestActionInfo"></param>
        /// <param name="sCmd"></param>
        private void ScriptActionError(TPlayObject PlayObject, string sErrMsg, TQuestActionInfo QuestActionInfo, string sCmd)
        {
            const string sOutMessage = "[脚本错误] {0} 脚本命令:{1} NPC名称:{2} 地图:{3}({4}:{5}) 参数1:{6} 参数2:{7} 参数3:{8} 参数4:{9} 参数5:{10} 参数6:{11} 玩家:{12}";
            string sMsg = string.Format(sOutMessage, sErrMsg, sCmd, this.m_sCharName, this.m_sMapName, this.m_nCurrX, this.m_nCurrY, QuestActionInfo.sParam1,
                QuestActionInfo.sParam2, QuestActionInfo.sParam3, QuestActionInfo.sParam4, QuestActionInfo.sParam5, QuestActionInfo.sParam6, PlayObject.m_sCharName);
            M2Share.MainOutMessage(sMsg);
        }

        private void ScriptConditionError(TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, string sCmd)
        {
            string sMsg;
            sMsg = "Cmd:" + sCmd + " NPC名称:" + this.m_sCharName + " 地图:" + this.m_sMapName + " 座标:" + (this.m_nCurrX).ToString() + ":"
                + (this.m_nCurrY).ToString() + " 参数1:" + QuestConditionInfo.sParam1 + " 参数2:" + QuestConditionInfo.sParam2 + " 参数3:" + QuestConditionInfo.sParam3
                + " 参数4:" + QuestConditionInfo.sParam4 + " 参数5:" + QuestConditionInfo.sParam5;
            M2Share.MainOutMessage("[脚本参数不正确] " + sMsg);
        }

        public void SendMsgToUser(TPlayObject PlayObject, string sMsg)
        {
            PlayObject.SendMsg(this, Grobal2.RM_MERCHANTSAY, 0, 0, 0, 0, this.m_sCharName + "/" + sMsg);
        }

        public string sub_49ADB8(string sMsg, string sStr, string sText)
        {
            string result;
            int n10;
            string s14;
            string s18;
            n10 = sMsg.IndexOf(sStr);
            if (n10 > -1)
            {
                s14 = sMsg.Substring(1 - 1, n10);
                s18 = sMsg.Substring(sStr.Length + n10, sMsg.Length - (sStr.Length + n10));
                result = s14 + sText + s18;
            }
            else
            {
                result = sMsg;
            }
            return result;
        }

        /// <summary>
        /// 玩家点击脚本标签
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="sData"></param>
        public virtual void UserSelect(TPlayObject PlayObject, string sData)
        {
            string sMsg;
            string sLabel = string.Empty;
            try
            {
                PlayObject.m_nScriptGotoCount = 0;
                // 处理脚本命令 @back 返回上级标签内容
                if ((sData != "") && (sData[0] == '@'))
                {
                    sMsg = HUtil32.GetValidStr3(sData, ref sLabel, new string[] { "\r" });
                    if (sLabel == "@goHero1")// 支持卧龙笔记移动
                    {
                        GotoLable(PlayObject, sLabel, false);
                    }
                    else
                    {
                        if ((PlayObject.m_sScriptCurrLable != sLabel))
                        {
                            if ((sLabel != M2Share.sBACK))
                            {
                                PlayObject.m_sScriptGoBackLable = PlayObject.m_sScriptCurrLable;
                                PlayObject.m_sScriptCurrLable = sLabel;
                            }
                            else
                            {
                                if (PlayObject.m_sScriptCurrLable != "")
                                {
                                    PlayObject.m_sScriptCurrLable = "";
                                }
                                else
                                {
                                    PlayObject.m_sScriptGoBackLable = "";
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.UserSelect");
            }
        }

        /// <summary>
        /// 功能：发送祝福语
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="sMsg">文字</param>
        public virtual void SendCustemMsg(TPlayObject PlayObject, string sMsg)
        {
            try
            {
                if (!M2Share.g_Config.boSendCustemMsg)
                {
                    PlayObject.SysMsg(GameMsgDef.g_sSendCustMsgCanNotUseNowMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                if (PlayObject.m_boSendMsgFlag)
                {
                    PlayObject.m_boSendMsgFlag = false;
                    M2Share.UserEngine.SendBroadCastMsg(PlayObject.m_sCharName + ": " + sMsg, TMsgType.t_Cust);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.SendCustemMsg");
            }
        }

        private IList<TDynamicVar> GetDynamicVarList(TPlayObject PlayObject, string sType, ref string sName)
        {
            IList<TDynamicVar> result = null;
            try
            {
                result = null;
                if (HUtil32.CompareLStr(sType, "HUMAN", 5))
                {
                    result = PlayObject.m_DynamicVarList;
                    sName = PlayObject.m_sCharName;
                }
                else if (HUtil32.CompareLStr(sType, "GUILD", 5))
                {
                    if (PlayObject.m_MyGuild == null)
                    {
                        return result;
                    }
                    result = PlayObject.m_MyGuild.m_DynamicVarList;
                    sName = PlayObject.m_MyGuild.sGuildName;
                }
                else if (HUtil32.CompareLStr(sType, "GLOBAL", 6))
                {
                    result = M2Share.g_DynamicVarList;
                    sName = "GLOBAL";
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.GetDynamicVarList");
            }
            return result;
        }
    }
}